<!DOCTYPE html>
<html>
<head>
<title>借款管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<#include "../../../include/resources.html">
<script type="text/javascript">
    //$.fn.iframeWidthResize(640);//页面最小宽度设置
    var dataGrid;
    var winWidth =  900;
    var winHeight = 600;
    var verifyTitle = "项目审核";
    var verifyUrl =  "/modules/additional/finanFlow/verifyFlowPage.html";
    var verifyWinParmeters = "'{0}','"+verifyTitle+"',900,500,'"+verifyUrl+"'";
	var verifyWindth = 700;

	var viewWidth = 700;
	var viewHeight = 600;
	var detailUrl = "/modules/additional/finanFlow/viewFlowProject.html";
	var detailTitle = "项目详情";
    
    var addUrl  = "/modules/additional/finanFlow/addFlowPage.html";
    var addTitle ="发布理财产品";
    
    var viewRepayPlanUrl="/modules/additional/finanFlow/viewFlowRepayPlan.html";  //查看还款计划
    var viewRepayPlanTitle = "还款计划详情";
    $(function() {
        dataGrid = $('#borrowManagerList').datagrid({
            url : 'flowProjectJson.html?status=99',
            fit : true,
            fitColumns : true, 
            border : false,
            pagination : true,
            idField : 'id',
            pageSize : pageSize,
            pageNums :1,
            pageList : pageList,
            sortName : 'id',
            sortOrder : 'asc',
            checkOnSelect : false,
            selectOnCheck : false,
            nowrap : false,
			singleSelect:true,
            columns : [ [    
			  { field: 'id', title: '编号',width: 50, sortable:false },              
			  { field: 'name', title: '标名',width: 150,  sortable:false },
			  { field: 'userName', title: '借款人姓名',width: 100,  sortable:false },
              { field: 'account', title: '项目总额', width: 90, sortable:false,formatter: function(value,row,index){
            	  return value+"元";
              }},
              { field: 'totalCopies', title: '总份数', width: 60, sortable:false,formatter: function(value,row,index){
            	  return value+"份";
              }},
             
              { field: 'startCopies', title: '起投份数', width: 70, sortable:false,formatter: function(value,row,index){
            	  return value+"份";
              }},
     
              { field: 'apr', title: '利率', width: 60, sortable:false,formatter: function(value,row,index){
            	  return value+"%";
              } }, 
              { field: 'timeLimit', title: '期限', width: 60,fixed:true, sortable:false,formatter: function(value,row,index){
            	  if (row.isDay == 1){
						return row.timeLimit + "天";
					} else {
						return value + "个月";
					}
              }},
              { field: 'addTime', title: '添加时间', width: 150,fixed:true, sortable:false,formatter: function(value,row,index){
            	  return getLocalTime(value,4);
  				  }  
              }, //0发布成功，1:初审通过，2：不通过，3:投满，6:结束
              { field: 'status', title: '状态', width: 80, fixed:true,sortable:false , 
					formatter: function(value,row,index){
  					if(row.status == 0){
  						return '发布成功';
  					} else if(row.status == 1){
  						return '初审通过';
  					} else if (row.status == 2){
  						return '不通过';
  					} else if (row.status == 3){
  						return '投满';
  					}  else if (row.status == 6){
  						return '结束';
  					}   else {
  						return value;
  					}
  				}  
              },
              { field: 'repayStyle', title: '还款方式', width: 90, sortable:false , 
					formatter: function(value,row,index){
  					if (row.repayStyle == 1){
  						return '按月分期还款';
  					} else if (row.repayStyle == 2){
  						return '一次性还款';
  					} else if (row.repayStyle == 3){
  						return '每月还息到期还本';
  					}  else {
  						return value;
  					}
  				}  
              },
              
              { field : 'action',
                title : '操作',
                width :75,
                fixed:true,
                align:'center',
                formatter : function(value, row, index) {
                	var str = '';
                  str += '<dl>';
                  str += '<dt><a href="javascript:void(0);" onclick="$.fn.formOptions.viewFun('+row.id+',detailTitle,viewWidth,viewHeight,detailUrl);" title="'+detailTitle+'">查看</a><i class="iconfont">&#xe639;</i></dt>' ;
                  str += '<dd>';
                 if(row.status ==0){
                   str += '<a href="javascript:void(0);" onclick="$.fn.dataGridOptions.editFun('+row.id+',verifyTitle,verifyWindth,winHeight,verifyUrl);" title="'+verifyTitle+'">审核</a>';
                 }else{
                	 str+='<a href="javascript:void(0);" onclick="$.fn.formOptions.viewFun('+row.id+',viewRepayPlanTitle,viewWidth,viewHeight,viewRepayPlanUrl);" title="'+viewRepayPlanTitle+'">还款计划</a>';
                 }
                  str += '</dd>'
                  str +=  '</dl>'
                  return str;
                }
            } ] ]
        });
    });
</script>
</head>
<body style="padding:0 20px;" >
    <div class="easyui-layout" data-options="fit : true,border : false">
        <div data-options="region:'north',border:false,collapsible:false" id="searchBox">
        	<div class="sLeft">
	            <form id="searchForm">
	            	<input type="text"  name="searchName" class="sInput" placeholder="输入用户名进行搜索" autocomplete="off" onkeydown="if(event.keyCode == 13){ $.fn.dataGridOptions.searchFun('#searchForm');return false;}"/><a href="javascript:;" title="查询" class="sBtn" onclick="$.fn.dataGridOptions.searchFun('#searchForm');">查询</a><a href="javascript:;" class="advBtn" title="条件查询">条件查询 <i class="iconfont">&#xe638;</i></a>
	            	<a href="javascript:void(0);" class="reloadIcon" onclick="dataGrid.datagrid('reload');" title="刷新" ><i class="iconfont">&#xe603;</i></a>
	            </form>
            </div>
            <form id="showAdw">
		        <ul class="showAdw" style="display:none;">
		        	<a href="javascript:void(0);"><i class="iconfont closeWin">&#xe63a;</i></a>
		       		<li><span>状态</span><select name="queryStatus" class="type">
	                  <option value="99" selected="selected">全部</option>
	                  <option value="0">发布成功</option>
	                  <option value="1">初审通过</option>
	                  <option value="3">投满</option>
	                  <option value="6">已结束</option>
	                </select>
	                </li>
	                <li><span>&nbsp;</span><a href="javascript:void(0);" class="searchBtn sureBtn" onclick="$.fn.dataGridOptions.searchFun('#showAdw');">确定</a><a href="javascript:void(0);" class="searchBtn" onclick="$.fn.dataGridOptions.cleanFun('#showAdw');">重置</a></li>
		        </ul>
	        </form>
	        <div class="sRight">
                <a onclick="$.fn.dataGridOptions.addFun(-1,addTitle,winWidth,winHeight,addUrl);" href="javascript:void(0);" class="addBtn"><i class="iconfont">&#xe629;</i>发布流转项目</a>     
     </div>
        </div>
        <div data-options="region:'center'" style="margin-top:30px;padding-bottom:30px;">
            <table id="borrowManagerList"></table>
        </div>
    </div>
     
</body>
</html>
<script src="${theme_dir}/js/search.js"></script>